PlantSight Enterprise Help

Using Regular Expressions for Class Mapping

Data

UserLabel Description Class DRY_WEIGHT
P1.M1.T1-V109 Ball valve BallValve 42
P20.H1.T3-V101 Special Ball valve ExtendeBallValve 30
P20.H1.T3-P001 Pump Pump 19

Configuration

{
  "id": 6,
  "name": "mapping 6",
  "importType": "smartExcel",
  
  "classKey": "Class",
  "columnHeaderIsPropertyName": true,
  "data": [
    {
      "selector": {
        "path": "$.items[*].properties[?(@.key==\"Class\")]",
        "regex": "^.*BallValve$"
      },
      "ecClass": {
        "name": "BALL_VALVE",
        "fullName": "ProcessFunctional:BALL_VALVE"
      }
    },
    {
      "sourceClass": "Pump",
      "targetClass": "CENTRIFUGAL_PUMP"
    }
  ],
    
}

The first data entry now consists of a selector and an EC class object instead of only "sourceClass" and "targetClass" properties. In the selector, you define how to find the class property in the json source data with a json path expression. The "regex" then matches the value of that property. By using this method, you can map the ball valve and the extended ball valve to same EC class without having two data objects in the mapping.